<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<script src="jquery.js"></script>
	<title>ajax get-请求</title>
</head>
<body>
	<form action="index.html" method="post" 
		enctype="application/x-www-form-urlencoded">		
		<input type="text" name="uname" placeholder="请输入用户名" /><br /><br />
		<input type="password" name="password" placeholder="请输入密码" /><br /><br />
		<button type="submit">登录</button>
	</form>
	<script>
		//AJAX:Asynchronous javascript and xml
		//异步的js与xml
		//在不重载页面的条件下更新页面的数据
		$('form').submit(function(ev){
			//阻止默认事件的刷新
			ev.preventDefault();
			console.log('已经阻止')
	//获取表单数据，自动将其转换成字符串序列化对
		
			var data = $(this).serialize();
			$.get({
				url:'index.html',//请求路径
				data:data,//请求数据
				success:function(resData){	// 请求数据成功的回调函数
					
				}
			})
			
		})
	</script>
</body>
</html>